#centos的latest版本
FROM centos:7
# 个人信息
MAINTAINER zcg <zcg@163.com>
#设置容器环境变量
ENV SRC_DIR /root/soft
#创建文件夹保存需要用到的依赖文件
RUN mkdir -p ${SRC_DIR}

#更新服务器，安装wget，安装epel源
RUN yum -y update \
    && yum -y install wget \
    && yum -y install epel-release \
    && yum makecache

#安装依赖包
RUN yum -y install \
    cmake \
    make \
    gcc \
    gcc-c++ \
    automake.noarch \
    autoconf.noarch \
    openssl \
    openssl-devel \
    bzip2-devel \
    readline-devel \
    ncurses-devel \
    boost-devel \
    libtool \
    perl-devel \
    perl-Net-Telnet.noarch


#安装必要软件
RUN yum -y install \
    #centos6.9版本安装mysql,mysql-devel,mysql-server
    mariadb-devel \
    mariadb-server \
    curl \
    git \
    vim \
    openssh-server \
    openssh \
    telnet \
    net-tools

#ACE环境
RUN cd ${SRC_DIR} \
    && wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-6.5.4-75.1.x86_64.rpm \
    && rpm -ivh ace-6.5.4-75.1.x86_64.rpm \
    && rm -f ace-6.5.4-75.1.x86_64.rpm \
    && wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/mpc-6.5.4-75.1.x86_64.rpm \
    && rpm -ivh mpc-6.5.4-75.1.x86_64.rpm \
    && rm -f mpc-6.5.4-75.1.x86_64.rpm \
    && wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-devel-6.5.4-75.1.x86_64.rpm \
    && rpm -ivh ace-devel-6.5.4-75.1.x86_64.rpm \
    && rm  -f ace-devel-6.5.4-75.1.x86_64.rpm

#配置时区，登录信息等
RUN ln -sf /usr/share/zoneinfo/Asia/Chongqing /etc/localtime \
    && sed -i \
        -e 's/^UsePAM yes/#UsePAM yes/g' \
        -e 's/^#UsePAM no/UsePAM no/g' \
        -e 's/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g' \
        -e 's/^#UseDNS yes/UseDNS no/g' \
        /etc/ssh/sshd_config \
    && echo "root" | passwd --stdin root \
    && ssh-keygen -q -b 1024 -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key \
    && ssh-keygen -q -b 1024 -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key \
    && echo "NETWORKING=yes" > /etc/sysconfig/network

RUN rm -rf ${SRC_DIR}/*
RUN rm -rf /tmp/*
